﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using BarcodeStandard;

namespace BarcodeStandardTests.Symbologies
{
    [TestClass]
    public class IATA2of5Tests
    {
        private readonly Barcode _barcode = new()
        {
            EncodedType = Type.IATA2of5,
        };

        [DataTestMethod]
        [DataRow("0380003562164928", "101010101110111010111011101010101110101011101010101110111010101011101110101010111011101011101110101010111010111010101011101110101010111010101110111010101011101011101110101010101110101110101110101110101011101010111011101010111010101010111011101010101110111001101")]
        [DataRow("12345678901234567", "101011101010101110101110101011101110111010101010101110101110111010111010101011101110101010101011101110111010101110101011101011101010101110111010111010101011101011101010111011101110101010101011101011101110101110101010111011101010101011101110101010111011101001101")]
        [DataRow("19279472947891274", "101011101010101110101110101110101011101010111010101011101110101110101110101010111010111010101011101110101110101011101011101011101010101110101110101010111011101110101011101010111010111010111010101011101011101010111010101011101110111010101110101110101011101001101")]
        public void EncodeBarcode(string data, string expected)
        {
            _barcode.Encode(data);
            Assert.AreEqual(expected, _barcode.EncodedValue, $"{_barcode.EncodedType}");
        }
    }
}
